package com.ecmp.demo.entity;

import com.ecmp.core.entity.BaseEntity;
import com.ecmp.core.entity.ICodeUnique;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;

@Access(AccessType.FIELD)
@Entity()
@Table(name = "student")
@DynamicInsert
@DynamicUpdate
public class Student extends BaseEntity implements ICodeUnique {
    @Column(name = "name", length = 20)
    private String name;

    /**
     * 代码
     * unique唯一约束
     */
    @Column(name = "code", length = 5, unique = true, nullable = false)
    private String code;


    @Column(name = "rank", nullable = false)
    private Integer rank = 0;

    public Integer getRank() {
        return rank;
    }

    public void setRank(Integer rank) {
        this.rank = rank;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }
}
